package com.itheima.bean;

import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

/**
 * ClassName: MyImportSelector
 * Description:
 * Date: 2023/03/22 PM 10:57:14
 * <p>
 * project: springboot
 * package: com.itheima.bean
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
public class MyImportSelector implements ImportSelector {

    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        try {
            Class<?> clazz = Class.forName("com.itheima.bean.Wolf");
            if (clazz != null) {
                return new String[]{"com.itheima.bean.Cat"};
            }
        } catch (ClassNotFoundException e) {
            // e.printStackTrace();
            return new String[0];
        }
        return null;
    }
}
